Skip to content

fix(issue summary): Close database connections after issue summary generation #97555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

seer-by-sentry[bot]
Copy link
Contributor

@seer-by-sentry seer-by-sentry bot commented Aug 9, 2025

Fixes SENTRY-4BWM. The issue was that: ThreadPoolExecutor's new threads request database connections, exhausting PostgreSQL's max_client_conn due to unreleased connections.

  • Wraps the get_issue_summary function call in a thread with a function _get_issue_summary_with_cleanup to ensure database connections are closed after the thread execution.
  • This prevents connection leaks when running in a thread.

This fix was generated by Seer in Sentry, triggered by Rohan Agarwal. 👁️ Run ID: 734760

Not quite right? Click here to continue debugging with Seer.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@roaga roaga changed the title feat(integrations): Close database connections after issue summary generation fix(issue summary): Close database connections after issue summary generation Aug 9, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 9, 2025
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #97555      +/-   ##
==========================================
- Coverage   80.73%   80.62%   -0.11%     
==========================================
  Files        8566     8560       -6     
  Lines      378963   376894    -2069     
  Branches    24538    24538              
==========================================
- Hits       305948   303871    -2077     
- Misses      72645    72653       +8     
  Partials      370      370              

@roaga roaga added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Aug 9, 2025
@roaga roaga marked this pull request as ready for review August 11, 2025 13:59
@roaga roaga requested review from a team as code owners August 11, 2025 13:59
@roaga roaga requested a review from a team August 11, 2025 14:00
@roaga roaga merged commit 4df4193 into master Aug 11, 2025
65 of 66 checks passed
@roaga roaga deleted the seer/fix-issue-summary-db-connections branch August 11, 2025 14:14
@JoshFerge
Copy link
Member

This PR has already been merged but I am not convinced this is the problem, nor the right solution. i would recommend reverting if there is no impact on the issue.

@roaga roaga added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Aug 11, 2025
@getsentry-bot
Copy link
Contributor

PR reverted: a7243f3

getsentry-bot added a commit that referenced this pull request Aug 11, 2025
…mmary generation (#97555)"

This reverts commit 4df4193.

Co-authored-by: roaga <[email protected]>
andrewshie-sentry pushed a commit that referenced this pull request Aug 12, 2025
…neration (#97555)

Fixes
[SENTRY-4BWM](https://sentry.io/organizations/sentry/issues/6793787515/).
The issue was that: ThreadPoolExecutor's new threads request database
connections, exhausting PostgreSQL's max_client_conn due to unreleased
connections.

- Wraps the `get_issue_summary` function call in a thread with a
function `_get_issue_summary_with_cleanup` to ensure database
connections are closed after the thread execution.
- This prevents connection leaks when running in a thread.


This fix was generated by Seer in Sentry, triggered by Rohan Agarwal. 👁️
Run ID: 734760

Not quite right? [Click here to continue debugging with
Seer.](https://sentry.io/organizations/sentry/issues/6793787515/?seerDrawer=true)

<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

---------

Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com>
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
andrewshie-sentry pushed a commit that referenced this pull request Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests Trigger: Revert Add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants